<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ include file="/common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src='<s:url value="/scripts/CustomTreeUI.js" includeParams="none"/>'></script>
<link rel="stylesheet" type="text/css" href='<s:url value="/scripts/column-tree.css" includeParams="none"/>'/>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/css.css">

<title>主题列表</title>
<script>
var  highlightcolor='#F8EABE';
//此处clickcolor只能用win系统颜色代码才能成功,如果用#xxxxxx的代码就不行,还没搞清楚为什么:(
var  clickcolor='#fff';
function  changeto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=highlightcolor&&source.id!="nc"&&cs[1].style.backgroundColor!=clickcolor)
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=highlightcolor;
}
}

function  changeback(){
source=event.srcElement;
if  (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="nc")
return
if  (event.toElement!=source&&cs[1].style.backgroundColor!=clickcolor)
//source.style.backgroundColor=originalcolor
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

function  clickto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=clickcolor&&source.id!="nc")
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=clickcolor;
}
else
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}


function onClick(){
		var Tree = Ext.tree;
   		var tree = new Tree.TreePanel({       
	        autoScroll:true,
	        animate:true,
	        enableDD:true,
	        containerScroll: true,
	        rootVisible:false,      
	        loader: new Tree.TreeLoader({dataUrl:'<s:url namespace="/querythemes" action="qdDomainDeploy!load4BuildTree.action"/>'})
	        //dataUrl:'<s:url namespace="/function" action="list!getFS.action"/>'
   	 	});
		
   		// set the root node
	    var root = new Tree.AsyncTreeNode({
	        text: '功能',
	        draggable:false,
	        id:'-1'
	    });
	    tree.setRootNode(root);
		
		var win = new Ext.Window({
		                //applyTo     : 'hello-win',
		                title:"选择分类",
		                layout      : 'fit',
		                width       : 300,
		                height		:400,
		                closable:false, 
		                closeAction :'close',
		                modal:true, 
		                plain       : true,
		                items:tree,
		                buttons: [
		                {
		                    text     : '确定',
		                    disabled : false,
		                    handler  :function(){
		                    var n = tree.getSelectionModel().getSelectedNode();
		                    if (n == null){
		                     alert("必须选择一个节点");
		                     return;
		             		}
		                    Ext.get("cpi").dom.value=n.id;
		                    Ext.get("cpn").dom.value=n.text;
		                    
		                    win.close();}
		                },
		                {
		                    text     : '取消',
		                    disabled : false,
		                    handler  :function(){
		                    Ext.get("cpi").dom.value='';Ext.get("cpn").dom.value='';
		                    win.close();}
		                }]
		  });	    
	    win.show();
	}
	
	function testDomains(){
		alert("1");
		document.all.testDomain.submit();
	}
</script>
</head>
<body>
<div class="main">
<div class="main_title"><b>你当前的位置：</b>主题查询-主题配置-主题发布-主题发布列表</div>
<s:form id="s_user_form" namespace="/querythemes" action="qdDomainDeploy!load4FindDomain.action">
<s:hidden name="pageSize" id="pageSize"/>
<table  cellpadding="1" cellspacing="1" class="search">
      <tr class="listr2">
        <td align="right">主题名</td>
        <td align="left" class="listr5">
        	<input type="text"   name="searchQdDomain.name" value="<s:property value="searchQdDomain.name"/>" class="searchInput" />        	
        </td> 
      </tr>        
      <tr class="listr2">
        <td align="right">主题分类名</td>
        <td align="left" class="listr5">
        	<input type="text"  id="cpn"  name="searchQdDomain.catalogId.catalogName" value="<s:property value="searchQdDomain.catalogId.catalogName"/>" class="searchInput" />
        	<a href="javascript:onClick();"  id="catalogButton">点击选择</a>
        	<input type="hidden" id="cpi" name="searchQdDomain.catalogId.catalogId" />
        </td>               
      </tr>
      <tr class="listr2">
        <td align="right">&nbsp;</td>
        <td align="left" class="listr5"><input type="submit" name="Submit" value="查询" class="btn"  onmouseover="this.className='btn_hover'" onmouseout="this.className='btn'" />
          <input type="reset" name="Submit2" value="重置" class="btn"  onmouseover="this.className='btn_hover'" onmouseout="this.className='btn'" /></td>
      </tr>
    </table>
</s:form>
<div class="botton">
	 
	  <%--<s:form id="testDomain" namespace="/querythemes" action="qdDomainDeploy!testDomain.action"><input name="" type="button" value="测试方法" class="add" onmouseover="this.className='add_hover'" onmouseout="this.className='add'"  onclick="testDomains()"/></s:form>	  
	  <input name="" type="button" value="修改" class="mudify" onmouseover="this.className='mudify_hover'" onmouseout="this.className='mudify'"  />
	  <input name="" type="button" value="删除" class="delete" onmouseover="this.className='delete_hover'" onmouseout="this.className='delete'" />
	  <input name="" type="button" value="校验" class="check" onmouseover="this.className='check_hover'" onmouseout="this.className='check'" />
	  <input name="" type="button" value="浏览" class="read" onmouseover="this.className='read_hover'" onmouseout="this.className='read'" />
	   --%>
</div>
<table id="res-table" cellpadding="1" cellspacing="1" class="tablelist"  onmouseover="changeto()"  onmouseout="changeback()">
  <tr class="toptitle">
  	<td>序号</td>
    <td>主题名</td>
	<td>所属主题分类</td>	
	<td>操作</td>
  </tr>
  <tbody>
	<s:iterator value="page.res" status="status">
		<s:if test="#status.even">
		 <tr class="listr1" onmouseover="this.className='listr3'" onmouseout="this.className='listr1'">
		</s:if>
		<s:else>
		 <tr class="listr2" onmouseover="this.className='listr3'" onmouseout="this.className='listr2'">
		</s:else>
			<td>&nbsp;<s:property value="#status.index+1" /></td>
			<td>&nbsp;<s:property value="name" /></td>
			<td>&nbsp;<s:property value="catalogId.catalogName" /></td>		
			<td>&nbsp;
				<s:url id="modifyUrl" namespace="/querythemes" action="qdDomainDeploy!load4Deploy.action" >
					<s:param name="strDomainId">
						<s:property value="id" />
					</s:param>
					<s:param name="searchQdDomain.name">
						<s:property value="searchQdDomain.name" />
					</s:param>
					<s:param name="searchQdDomain.catalogId.catalogName">
						<s:property value="searchQdDomain.catalogId.catalogName"/>
					</s:param>
					<s:param name="searchQdDomain.catalogId.catalogId">
						<s:property value="searchQdDomain.catalogId.catalogId" />
					</s:param>
					<s:param name="pageSize">
						<s:property value="pageSize" />
					</s:param>
				</s:url>
				<s:a href='%{modifyUrl}'>发布</s:a>
			</td>
		</tr>
	 </s:iterator>
   </tbody>
</table>


<table class="tablelist" >
<s:set  var="totle" scope="request" value="page.count"/>
<s:set  var="pageSize" scope="request" value="pageSize"/>
<%  
    Integer  count = new Integer(0);
    if(request.getAttribute("totle")!=null){
    	count = (Integer) request.getAttribute("totle");
    }	
	Integer pageSize = (Integer) request.getAttribute("pageSize");
%>
		
	<tr>
		<td class="listr4" align="left" colspan="4">		
			<pg:pager  url="qdDomainDeploy!load4FindDomain.action" items='<%=count.intValue()%>'	maxPageItems='<%=pageSize%>' export="pageOffset,currentPage=pageNumber">
				<pg:param name="searchQdDomain.name" />
				<pg:param name="searchQdDomain.catalogId.catalogName" />
				<pg:param name="searchQdDomain.catalogId.catalogId" />
				<pg:param name="pageSize" />
				<pg:index export="pages">
					<table>
						<tr>
							<td>
								当前<b class="fontred"><%= currentPage%></b>/<%=pages%>页&nbsp;&nbsp;&nbsp;&nbsp;
							</td>
							<td>
								<pg:first>
									<a href="<%=pageUrl%>&pageNo=<%=pageNumber%>">首页</a>
								</pg:first>
							</td>
							<td>	
								<pg:prev>
									<a href="<%=pageUrl%>&pageNo=<%=pageNumber%>">上一页</a>
								</pg:prev>
							</td>
							<td>
								<pg:pages>
									<%
										if (currentPage == pageNumber) {
									%>
									<font color="red"><%=pageNumber%></font>
									<%
										} else {
									%>
									<a href="<%=pageUrl%>&pageNo=<%=pageNumber%>"><%=pageNumber%></a>
									<%
										}
									%>
								</pg:pages>
							</td>
							<td>
								<pg:next>
									<a href="<%=pageUrl%>&pageNo=<%=pageNumber%>">下一页</a>
								</pg:next>
							</td>
							<td>
								<pg:last>
									<a href="<%=pageUrl%>&pageNo=<%=pageNumber%>">末页</a>&nbsp;&nbsp;&nbsp;&nbsp;
								</pg:last>
							</td>				
							<td>
								&nbsp;
							</td>
							<td style="padding-left: 10px;">
								每页显示的记录数
							</td>
							<td>
								<input type="text" class="PageInput" value="<%=pageSize %>" onchange="Ext.get('pageSize').dom.value=this.value;Ext.get('s_user_form').dom.submit();"/>
							</td>
							<td>
								条
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
					</table>
				</pg:index>
			</pg:pager>
		</td>
	</tr>
</table>
</div>
</body>
</html>